import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/user',
    children: [
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/user/UserView.vue')
      },
      {
        path: '/employee',
        name: 'employee',
        component: () => import('../views/employee/EmployeeView.vue')
      },
      {
        path: '/attendance',
        name: 'attendance',
        component: () => import('../views/attendance/AttendanceView.vue')
      },
      {
        path: '/salary',
        name: 'salary',
        component: () => import('../views/salary/SalaryView.vue')
      },
      {
        path: '/performance',
        name: 'performance',
        component: () => import('../views/performance/PerformanceView.vue')
      },
      {
        path: '/position',
        name: 'position',
        component: () => import('../views/position/PositionView.vue')
      },
      {
        path: '/resume',
        name: 'resume',
        component: () => import('../views/resume/ResumeView.vue')
      },
      {
        path: '/training',
        name: 'training',
        component: () => import('../views/training/TrainingView.vue')
      },
      {
        path: '/trainingEmployee',
        name: 'trainingEmployee',
        component: () => import('../views/trainingEmployee/TrainingEmployeeView.vue')
      },
      {
        path: '/application',
        name: 'application',
        component: () => import('../views/application/ApplicationView.vue')
      },
      {
        path: '/audit',
        name: 'audit',
        component: () => import('../views/audit/AuditView.vue')
      },
      {
        path: '/department',
        name: 'department',
        component: () => import('../views/department/DepartmentView.vue')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('../views/user/MyView.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
